package cn.jinjie.day04.test03;

import cn.jinjie.day03.test12.Inter1;

public class Demo1 {
    public static void main(String[] args) {
        useIConverter(new IConverter() {
            @Override
            public int convert(String s) {
                return Integer.parseInt(s);
            }
        });
        //lambda
        useIConverter(s -> Integer.parseInt(s));
        //方法引用
        useIConverter(Integer::parseInt);
        useIConverter(new IConverter() {
            @Override
            public int convert(String s) {
                return s.length();
            }
        });
        //lambda
        useIConverter(s -> s.length());
        //方法引用
        useIConverter(String::length);
    }

    public static void useIConverter(IConverter i) {
        int convert = i.convert("456");
        System.out.println(convert);
    }
}
